<?php
abstract class AbstractHCPlotOptions extends AbstractHCObject
{
    protected $m_oDataLabels;
    protected $m_oEvents;
    protected $m_oMarker;
    protected $m_oPoint;
    protected $m_oStates;
    protected $m_sType;
    protected $m_bIsActive;
    
    
    /**
     * Constructeur de la classe
     * Initialise les paramètres des types de 
     * 
     * @param unknown_type $psType
     */
    public function __construct()
    {
        $this->m_oDataLabels = new CHCPlotDataLabels();
        $this->m_oEvents     = new CHCPlotEvents();
        $this->m_oMarker     = new CHCPlotMarker();
        $this->m_oPoint      = new CHCPoint();
        $this->m_oStates     = new CHCPlotStates();
        
        $this->m_bIsActive   = false;
    }
    
    
    /**
     *  Enable or disable the initial animation when a series is displayed. 
     *  
     *  Defaults to true.
     *  
     *  @param $pbBoolean
     */
    public function setAnimation($pbBoolean=true)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
        $this->setParam('animation', $pbBoolean);
    }
    
    
    /**
	 * Alias de $this->setAnimation()
     */
    public function animate($pbBoolean=true)
    {
        return $this->setAnimation($pbBoolean);
    }
    
    
    /**
     *  You can set the cursor to "pointer" if you 
     *  have click events attached to the series, 
     *  to signal to the user that the points and 
     *  lines can be clicked. 
     *  
     *  Defaults to ''.
     *  
     * @param $psString
     */
    public function setCursor($psString='')
    {
        if (CSDebug::assertString($psString, false)) return false;
        
        $this->setParam('cursor', $psString);
    }
    
    
    /**
     *  Defines the appearance of the data labels, static labels for each point. 
     */
    public function setDataLabels()
    {
        return $this->m_oDataLabels;
    }
    
    /**
     *  Enable or disable the mouse tracking for a specific series. Defaults to true.
     *  
     * @param Boolean $pbBoolean
     */
    public function enableMouseTracking($pbBoolean=true)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
        $this->setParam('enableMouseTracking', $pbBoolean);
    }   
    
    
    /**
     *  Event listeners for the series. 
     */
    public function setEvents()
    {
        return $this->m_oEvents;
    }
    
    
    /**
     *  Pixel with of the graph line. Defaults to 2.
     *  
     * @param $pnInteger
     */
    public function setLineWidth($pnInteger=2)
    {
        if (CSDebug::assertInteger($pnInteger, true)) return false;
        
        $this->setParam('lineWidth', $pnInteger);
    }
    
    
    /**
     *  Defines the appearance of the point markers. 
     */
    public function setMarker()
    {
        return $this->m_oMarker;
    }
    
    
    /**
     * plotOptions.line.point   
     */
    public function setPoint()
    {
        return $this->m_oPoint;
    }
    
    
    /**
     *  If no x values are given for the points in a series, 
     *  pointStart defines on what value to start. 
     *  For example, if a series contains one yearly 
     *  value starting from 1945, set pointStart to 1945. 
     *  
     *  Defaults to 0.
     *  
     * @param $pnInteger
     */
    public function setPointStart($pnInteger=0)
    {
        if (CSDebug::assertInteger($pnInteger, true)) return false;
        
        $this->setParam('pointStart', $pnInteger);
    }
    
    
    /**
     *  If no x values are given for the points in a series, 
     *  pointInterval defines the interval of the x values. 
     *  For example, if a series contains one value every decade starting from year 0, 
     *  set pointInterval to 10. 
     *  
     *  Defaults to 1.
     *  
     * @param $pnInteger
     */
    public function setPointInterval($pnInteger=1)
    {
        if (CSDebug::assertInteger($pnInteger, true)) return false;
        
        $this->setParam('pointInterval', $pnInteger);
    }
    
    
    /**
     *  Whether to apply a drop shadow to the graph line. 
     *  
     *  Defaults to true.
     *  
     * @param Boolean $pbBoolean
     */
    public function setShadow($pbBoolean=true)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
        $this->setParam('shadow', $pbBoolean);
    }   
    
    
    /**
     *  Whether to display this particular series or series type in the legend. 
     *  
     *  Defaults to true.
     *  
     * @param $pbBoolean
     */
    public function setShowInLegend($pbBoolean=true)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
        $this->setParam('showInLegend', $pbBoolean);
    }   
    
    
    /**
     * Alias de $this->setShowInLegend()
     * 
     * @param Boolean $pbBoolean
     */
    public function showInLegend($pbBoolean=true)
    {
        $this->setShadow($pbBoolean);
    }   
    
    
    /**
     *  Whether to stack the values of each series on top of each other. 
     *  Possible values are 
     *  null to disable, 
     *  "normal" to stack by value or 
     *  "percent". 
     *  
     *  Defaults to null.
     */
    public function setStacked($psString)
    {
        // default
        if ($psString == 'numm' || is_null($psString)) return true;
        
        if (CSDebug::assertString($psString)) return false;
        if (!in_array($psString, array('normal', 'percent'))) return false;
        
        $this->setParam('stacking', $psString);
    }
    
    
    /**
     *  A wrapper object for all the series options in specific states. 
     */
    public function setStates()
    {
        return $this->m_oStates;
    }
    
    
    /**
     *  Set the initial visibility of the series. Defaults to true.
     *  
     * @param $pbBoolean
     */
    public function setVisible($pbBoolean=true)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
       $this->setParam('visible', $pbBoolean);
    }
    
    
    /**
     *  Fill color for the area. When "auto", the series' color is used with the series' fillOpacity. 
     *  
     *  Defaults to "auto".
     *  
     * @param $psColor
     */
    public function fillColor($psColor='auto')
    {
        // default
        if ($psColor == 'auto') return true;
        
        if (CSDebug::assertHex($psColor)) return false;
        
        $this->setParam('fillColor', $psColor);
    }
    
    
    /**
     *  Fill opacity for the area from 1 to 100
     *  
     *  Defaults to 75.
     *  
     * @param $pnInteger
     */
    public function setFillOpacity($pnInteger=75)
    {
        if (CSDebug::assertInteger($pnInteger)) return false;
        
        $this->setParam('fillOpacity', ($pnInteger / 100));
    }
    
    
    /**
     *  A separate color for the graph line. 
     *  By default the line takes the color  of the series, 
     *  but the lineColor setting allows setting a separate color 
     *  for the line without altering the fillColor. 
     *  
     *  Defaults to null.
     *  
     * @param String $psColor
     */
    public function setLineColor($psColor='auto')
    {
        if (CSDebug::assertHex($psColor)) return false;
        
        $this->setParam('lineColor', $psColor);
    }
}

?>